/**
 * 
 */
package com.shequan.user.service.impl;

import org.apache.log4j.Logger;

import com.shequan.common.bean.ResultDataStruct;
import com.shequan.common.bean.ViewTextConstans;
import com.shequan.user.bean.bo.UserInfoBO;
import com.shequan.user.bean.pojo.UserInfoExt;
import com.shequan.user.dao.UserInfoExtDAO;
import com.shequan.user.service.UserInfoExtService;

/**
 * <P>
 * Copyright 2012.
 * </p>
 * <P>
 * All Rights Reserved.
 * </p>
 * 
 * @author Administrator
 * @version 1.0, 2012-3-6
 * @see com.shequan.user.service.impl.UserInfoExtServiceImpl
 * @since 1.0
 */
public class UserInfoExtServiceImpl implements UserInfoExtService {
	private final static Logger log = Logger
			.getLogger(UserInfoExtServiceImpl.class);
	private UserInfoExtDAO userInfoExtDao;

	public void setUserInfoExtDao(UserInfoExtDAO userInfoExtDao) {
		this.userInfoExtDao = userInfoExtDao;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.shequan.user.service.UserInfoExtService#modifyUserInfoExt(com.shequan
	 * .user.bean.bo.UserInfoBO)
	 */
	public ResultDataStruct<String> addUserInfoExt(UserInfoBO userInfoBo) {
		log.debug("---in addUserInfoExt---");
		ResultDataStruct<String> rts = new ResultDataStruct<String>();
		UserInfoExt userInfoExt = new UserInfoExt();
		int rowNumber;
		try {
			userInfoExt.setUserId(Integer.parseInt(userInfoBo.getUserId()));
			rowNumber = userInfoExtDao.insert(userInfoExt);
			if (rowNumber == 1) {
				rts.setBusiSuccess(true);
				log.debug("新插入用户扩展信息ID:" + userInfoExt.getUserInfoExtId());
				rts.setData(String.valueOf(userInfoExt.getUserInfoExtId()));
			} else {
				rts.setMessage(ViewTextConstans.USER_REGIST_UNSUCCESS_MEG);
			}
		} catch (Exception e) {
			log.error("", e);
			rts.setSuccess(false);
			rts.setMessage(ViewTextConstans.USER_REGIST_UNSUCCESS_MEG);
		}
		return rts;
	}

}
